<template>
  <div class="dataView">
    <el-row class="header">
      <el-col :span="12">
        <el-menu
          :default-active="activeIndex"
          :ellipsis="false"
          mode="horizontal"
          @select="handleSelect"
        >
          <el-menu-item index="0" @click="router.push({ name: 'DataSource' })"
            >数据来源
          </el-menu-item>
          <div class="flex-grow"></div>
          <el-menu-item
            index="1"
            @click="router.push({ name: 'DataConnection' })"
            >数据连接
          </el-menu-item>
        </el-menu>
      </el-col>
      <el-col :span="12" class="back">
        <el-tooltip content="返回" effect="light" placement="left">
          <el-icon
            :size="20"
            class="icon"
            @click="router.push({ name: 'PgScene' })"
          >
            <Back />
          </el-icon>
        </el-tooltip>
      </el-col>
    </el-row>
    <router-view style="height: calc(100% - 41px)"></router-view>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";

const activeIndex = ref("0");
const handleSelect = (key, keyPath) => {
  console.log(key, keyPath);
};
const router = useRouter();
</script>

<style lang="scss" scoped>
.dataView {
  height: 100%;

  .header {
    border-bottom: solid 1px #dedede;
  }

  :deep .el-menu {
    border: none;
    height: 40px;
  }

  .back {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;

    .icon {
      cursor: pointer;
      color: #808080;

      &:hover {
        color: skyblue;
      }
    }
  }
}
</style>